import router from '../../router/index.js'
import { LoginRequest , registerRequest , mailboxRequest , resetRequest , infoRequest } from '../../service/login/login'

const login = {  
  namespaced: true,
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
    async LoginAction (context , account) {
      const loginResult = await LoginRequest(account)
      router.push('/main')
    },
    async RegisterAction (context, account) {
      const loginResult = await registerRequest(account)
      router.push('/userInfo')      
    },
    async MailboxAction (context, mailbox) {
      const MailboxResult = await mailboxRequest(mailbox)
      router.push('/rsPassword')      
    },
    async ResetAction (context, password) {
      const ResetResult = await resetRequest(password)
      router.push('/login')      
    },
    async infoAction (context, info) {
      const infoResult = await infoRequest(info)
      router.push('/login')
    }
  },
  modules: {
  }
}

export default login